Ext.BLANK_IMAGE_URL = "./js/ext/resources/images/default/s.gif";
Ext.QuickTips.init();// 启动悬停提示
var left;
Ext.onReady(function() {
			// 创建北面的面板
			var top = new Ext.Panel({
						region : "north",
						title : "LOGO",
						height : 80,
						html : "这里放LOGO"
					});
			// 左边的树
			left = new Ext.tree.TreePanel({
						region : "west",
						title : "后台功能导航",
						collapsible : true,
						split : true,
						containerScroll : true,
						autoScroll : true,
						width : 200,
						listeners : {
							dblclick : function(n,event) {
								event.stopEvent(); 
								// alert(n.attributes.url);
								var url = n.attributes.url;
								var id = n.attributes.id;
								if (url) {
									if (center.getItem(id)) {
										// 表示标签已打开,则激活
										center.setActiveTab(id);
									} else {
										// 表示标签还没有打开,创建新页面
										// 有url才打开页面
										var p = new Ext.Panel({
											//layout:"fit",
													title : n.attributes.text, // 标题就是节点的文本
													id : id, // 标签的ID和节点的ID一样
													/*autoLoad : {
														url : url,
														scripts : true
													},*/
													html : "<iframe src=\"" + url + "\" style='height:100%;width:100%;' frameborder=0></iframe>",   

													closable : true
												});
										center.add(p);
										center.setActiveTab(p);
									}
								
								}
							}
						}
					});
			var root = new Ext.tree.TreeNode({
						id : "root",
						text : "新闻管理系统",
						leaf : "false"
					});
			var column_Mg = new Ext.tree.TreeNode({
                        id:"columnMg",
						text : "栏目管理",
                        leaf:"false"
						//url : "columnpage.html"
					});
			var message_Mg = new Ext.tree.TreeNode({
                        id:"messageMg",
						text : "信息管理",
                        leaf:"false"
						//url : "emplist.html"
					});
			var other_Mg = new Ext.tree.TreeNode({
                        id:"otherMg",
						text : "信息管理",
                        leaf:"false"
						//url : "emplist.html"
					});
            var level1 = new Ext.tree.TreeNode({id:"level1",text : "一级栏目",leaf:"true",url : "#.html"});
            var level2 = new Ext.tree.TreeNode({id:"level2",text : "二级栏目",leaf:"true",url : "#.html"});
            var add_New = new Ext.tree.TreeNode({id:"newsMain",text : "新闻维护",leaf:"true",url : "newsMain.jsp"});
            var image_Mg = new Ext.tree.TreeNode({id:"imageMg",text : "图片附件维护",leaf:"true",url : "#.html"});
            
            column_Mg.appendChild([level1,level2]);
            message_Mg.appendChild([add_New]);
            other_Mg.appendChild([image_Mg]);
			root.appendChild([column_Mg,message_Mg,other_Mg]);
			left.setRootNode(root);
			
			
            var right= new Ext.Panel({
                    region:"east",
                    title:"未定义",
                    collapsible : true,
                        split : true,
                        containerScroll : true,
                        autoScroll : true,
                        width : 200
            });
            
            // 中间的选项面板
			var center = new Ext.TabPanel({
						region : "center",
						defaults : {
							autoScroll : true
						},// 自动出现滚动条
						items : [{
									title : "首页",
									html : "欢迎进入后台管理系统！",
									id : "index"
								}],
						enableTabScroll : true
					});
			center.setActiveTab("index");
			// 底部的面板
			var bottom = new Ext.Panel({
						region : "south",
						html : "版权所有，翻版必究",
						bodyStyle : "padding: 10px;text-align: center; font-size:12px"
					});
			var vp = new Ext.Viewport({
						layout : "border",
						items : [top, left,right, center, bottom]
					});
			left.expandAll();
		})
